﻿#if OldModel
using System;
using System.ComponentModel.Composition;
using System.Linq;

namespace Importer
{
  public class Converter
  {
    [Import]
    public Operatz Operations { get; set; }

    [Import]
    public ValNazv_db Currencies { get; set; }

    [Import]
    public rashods Expenses { get; set; }
    [Import]
    public dohods Incomes { get; set; }
    [Import]
    public KoshNazv Assets { get; set; }

    public void Run()
    {
//      using (var ctx = new AccountantContext())
//      {
//        var curr = ctx.Currencies.AsEnumerable()
//          .ToDictionary(c => c.Name, c => c);
        
//      }
//      foreach (var row in Assets.Rows)
//        Console.WriteLine(string.Join("\t\t", row.Values));
//      Console.WriteLine("-------------------------");
//      foreach (var row in Incomes.Rows)
//        Console.WriteLine(string.Join("\t", row.Values));
//      Console.WriteLine("-------------------------");
      foreach (var row in Operations.Rows.Where(r => r.Tip =="Расход").Take(100))
        Console.WriteLine(string.Join("\t", row.Values));
        //      foreach (var g in Incomes.Rows.GroupBy(r => r.Kategoria))
//        Console.WriteLine(g.Key);
        
//      using (var writer= new StreamWriter("operations.txt", false, Encoding.UTF8))
//      foreach (var row in Operations.Rows)
//        writer.WriteLine(string.Join("\t", row.Values));
      Console.ReadKey();
    }
  }
}
#endif